#include "library2/libhttpclient.h"
#include "gtest/gtest.h"

using namespace std;
using namespace basic::library2;

TEST(httpTest, GET)
{
    CHttpClient ch;
    apr_uint32_t dwRetCode;
    ch.Get("http://www2.bocaiwawa.com/channel/interface/get_datafile.php?file=remote:channel/shengfucai/package/SFC20100907183158PSFD10079F8BC9QOT9PZS4LE.txt&sign=805a17830e2127b96ca0be8533b6c36e", dwRetCode);
//    ch.GetLastErrorMsg();
    cout<<"dwRetCode: "<<dwRetCode<<endl;
    cout<<"bodylen: "<<ch.GetBodyLength()<<endl;
//    cout<<"body: "<<ch.GetBody()<<endl;
}

TEST(httpTest, POST)
{
    CHttpClient ch;
    apr_uint32_t dwRetCode;
    string sPostData("file=remote%3Achannel%2Fshengfucai%2Fpackage%2FSFC20100907183158PSFD10079F8BC9QOT9PZS4LE.txt&sign=805a17830e2127b96ca0be8533b6c36e");
    cout<<ch.Post("http://www2.bocaiwawa.com/channel/interface/get_datafile.php", sPostData, dwRetCode)<<endl;
//    cout<<ch.GetLastErrorMsg()<<endl;
    cout<<"dwRetCode: "<<dwRetCode<<endl;
    cout<<"bodylen: "<<ch.GetBodyLength()<<endl;
//    cout<<"body: "<<ch.GetBody()<<endl;
}
